#ifndef XABSTRACTSYNTAXTREEBUILDERIMPL_H
#define XABSTRACTSYNTAXTREEBUILDERIMPL_H
#include <cassert>
#include <astree/xabstractsyntaxtreebuilder.h>

template<class V>
class XAbstractSyntaxTreeCreator_Generic : public XAbstractSyntaxTreeCreator {
  public:
    XAbstractSyntaxTreeCreator_Generic() = delete;
    XAbstractSyntaxTreeCreator_Generic(const std::wstring& name) {
        static_assert(std::is_base_of<XAbstractSyntaxTree, V>::value);
        setName(name);
    }
  public:
    std::shared_ptr<XAbstractSyntaxTree> create(const XTokenBlock& tokens, uint32_t row, uint32_t col, std::shared_ptr<XAbstractSyntaxTreeBuilder> builder) {
        skipToCol ++;
        return std::make_shared<V>(tokens.at(row).tokens.at(col));
    }
};

#endif // XABSTRACTSYNTAXTREEBUILDERIMPL_H
